package com.zznzzn.androidshixun0826;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Objects;

public class Contact implements Serializable {
    public int id;
    public String name;
    public String phone;
    public String address;
    public byte[] photo;

    public Contact() {

    }

    public Contact(int id,String name, String phone, String address , byte[] photo) {
        this.id = id;
        this.name = name;
        this.phone = phone;
        this.address = address;
        this.photo = photo;
    }
    public Contact(String name, String phone, String address , byte[] photo) {
        this.name = name;
        this.phone = phone;
        this.address = address;
        this.photo = photo;
    }

    public byte[] getPhoto() {
        return photo;
    }

    public void setPhoto(byte[] photo) {
        this.photo = photo;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Contact)) return false;
        Contact contact = (Contact) o;
        return id == contact.id &&
                Objects.equals(name, contact.name) &&
                Objects.equals(phone, contact.phone) &&
                Objects.equals(address, contact.address) &&
                Arrays.equals(photo, contact.photo);
    }

    @Override
    public int hashCode() {
        int result = Objects.hash(id, name, phone, address);
        result = 31 * result + Arrays.hashCode(photo);
        return result;
    }

    @Override
    public String toString() {
        return "Contact{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", phone='" + phone + '\'' +
                ", address='" + address + '\'' +
                ", photo=" + Arrays.toString(photo) +
                '}';
    }
}
